"syntaxenable
set nu
set mouse=a
syntax on

let Tlist_Auto_Open=1
let Tlist_Auto_Start=1
let Tlist_Show_One_File=1     "不同时显示多个文件的tag，只显示当前文件的    
let Tlist_Exit_OnlyWindow=1   "如果taglist窗口是最后一个窗口，则退出vim   
let Tlist_Ctags_Cmd="/usr/bin/ctags" "将taglist与ctags关联 
let Tlist_Use_SingleClick=1

if filereadable("tags")
	set tags+=tags
else
	let tags_file=findfile("tags", ".;")
	if !empty(tags_file) && filereadable(tags_file)
		exe 'set tags+='.tags_file
	endif
endif

au BufReadPost * if line("'\"") > 0|if line("'\"") <= line("$")|exe("norm '\"")|else|exe "norm $"|endif|endif   

set cscopequickfix=s-,c-,d-,i-,t-,e-,g-
set cspc=3
set cscopetag
nmap <C-R>s :cs find s <C-R>=expand("<cword>")<CR><CR>
nmap <C-R>g :cs find g <C-R>=expand("<cword>")<CR><CR>
nmap <C-R>c :cs find c <C-R>=expand("<cword>")<CR><CR>
nmap <C-R>t :cs find t <C-R>=expand("<cword>")<CR><CR>
nmap <C-R>e :cs find e <C-R>=expand("<cword>")<CR><CR>
nmap <C-R>f :cs find f <C-R>=expand("<cword>")<CR><CR>
nmap <C-R>i :cs find i ^<C-R>=expand("<cword>")<CR>$<CR>
nmap <C-R>d :cs find d <C-R>=expand("<cword>")<CR><CR>

if has("cscope")
	set csprg=/home/vick.sun/local/bin/gtags-cscope
	set cscopetag
	set csto=1    
	"set cst
	"let csdb_name="cscope.out"
	let csdb_name="GTAGS"
	"set nocsverb
	" add any database in current directory
	if filereadable(csdb_name)
		exe "cs add" csdb_name
	else
		let cscope_file=findfile(csdb_name, ".;")
		let cscope_pre=matchstr(cscope_file, ".*/")
		if !empty(cscope_file) && filereadable(cscope_file)
			exe "cs add" cscope_file
			"exe "cs add" cscope_file cscope_pre
		endif
	endif
	"set csverb
endif

"检测文件的类型      
filetype on  
  
"记录历史的行数      
set history=1000  
  
"自动对齐      
set autoindent  
set cindent  
  
"智能选择对齐方式      
set smartindent  
  
"tab为4个空格      
set tabstop=4  
  
"当前行之间交错时使用4个空格      
set shiftwidth=4  
  
"设置匹配模式，输入做括号会出现右括号      
set showmatch  
  
"编辑时显示光标状态      
set ruler  
  
"高亮查找    
set hlsearch  

let g:neocomplcache_enable_at_startup = 1
nmap <C-x>1 :set mouse=v<CR>:set nonu<CR>:TlistClose<CR>
nmap <C-x>0 :set mouse=a<CR>:set nu<CR>:TlistOpen<CR>
